﻿@model S4Store.Models.Decorate.PackageCarVerionChageModel
@{
    Layout = null;
    ViewBag.Title = "PackageCarVerionChage";

    S4Store.Models.Chart.Column ChartModel = new S4Store.Models.Chart.Column();
    ChartModel.Name = "各车型套餐车版本更新状况";
    ChartModel.YAxis = "各车型套餐车版本更新状况";
    foreach (var m in Model.Reports)
    {
        ChartModel.XAxis.Add(m.CarBrand.Name);
    }
    S4Store.Models.Chart.ChartSeries series1 = new S4Store.Models.Chart.ChartSeries();
    series1.Name = "厂方标配版本";
    foreach (var m in Model.Reports)
    {
        series1.Data.Add(m.EnbleModelCount);
    }
    ChartModel.Serieses.Add(series1);

    S4Store.Models.Chart.ChartSeries series2 = new S4Store.Models.Chart.ChartSeries();
    series2.Name = "套餐版本设计目标";
    foreach (var m in Model.Reports)
    {
        series2.Data.Add((m.CarKpiMonthConfig.PakeageDesignTarget * 3 * m.EnbleModelCount / 100).AutoRound());
    }
    ChartModel.Serieses.Add(series2);


    S4Store.Models.Chart.ChartSeries series3 = new S4Store.Models.Chart.ChartSeries();
    series3.Name = "上旬套餐车版本数";
    foreach (var m in Model.Reports)
    {
        series3.Data.Add(m.CarModelMonthConfigs.Count(t=>t.IsLstTenVersion));
    }
    ChartModel.Serieses.Add(series3);

    S4Store.Models.Chart.ChartSeries series4 = new S4Store.Models.Chart.ChartSeries();
    series4.Name = "中旬套餐车版本数";
    foreach (var m in Model.Reports)
    {
        series4.Data.Add(m.CarModelMonthConfigs.Count(t => t.IsMidTenVersion));
    }
    ChartModel.Serieses.Add(series4);


    S4Store.Models.Chart.ChartSeries series5 = new S4Store.Models.Chart.ChartSeries();
    series5.Name = "下旬套餐车版本数";
    foreach (var m in Model.Reports)
    {
        series5.Data.Add(m.CarModelMonthConfigs.Count(t => t.IsLastTenVersion));
    }
    ChartModel.Serieses.Add(series5);
    ChartModel.IsRate = false;


    List<S4Store.Models.Chart.RedGreenIndex> RedGreenIndexs = new List<S4Store.Models.Chart.RedGreenIndex>();
    foreach (var m in Model.Reports)
    {
        S4Store.Models.Chart.RedGreenIndex index = new S4Store.Models.Chart.RedGreenIndex();
        index.Size = S4Store.Models.Chart.RedGreenIndex.IndexSize.Middle;
        var versionchagelv = (m.CarKpiMonthConfig.PakeageDesignTarget * 3 * m.EnbleModelCount / 100).AutoRound()-m.EnbleModelCount;
        index.Value = versionchagelv.ToString();
        if (versionchagelv >= 0)
        {
            index.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Green;
        }else{
            index.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Red;
        }
        index.Url = Url.Action("PackageCarVerionChageDetail", new { SearchCarBrandId = m.CarBrand.Id });
        index.Tip =m.CarBrand.Name+"套餐车版本更换实况";
        index.Title = "版本更换率目标与实际套餐车版本更换率的差值";
        RedGreenIndexs.Add(index);
    }
}
<div style="height:100%; overflow:auto">
@Html.Action("ReportBar", "Common", Model.BarModel)
<div style="position:relative; width:100%">
      
        @Html.Partial("../Chart/Column", ChartModel)
        @Html.Partial("../Chart/RedGreenIndex", RedGreenIndexs)
    
</div>
</div>